<!-- 单张图片上传 -->
<template>

  <el-upload :action="url" class="h100 w100 text-center  dxcvgdfgfyhgf" accept=".jpeg, .jpg,.png" :file-list="fileList"
    drag multiple :on-success="successHandle" v-loading="zxczxtrtr" :before-upload="beforeUploadHandle">
    <div>
      <img :src="dximg" class="w100 h100 cz" v-if="dximg">
      <el-icon class="el-icon--upload" v-else><upload-filled /></el-icon>
    </div>
  </el-upload>

</template>
<script lang='ts' setup>
import Upload from "@/views/oss/oss-upload.vue";
import { apiurl } from "@/utils/utils"
import { ref, nextTick } from "vue"
import { ElMessage } from "element-plus";
import { getToken } from "@/utils/cache";
let props = defineProps({
  dximg: { type: String },
});
const zxczxtrtr = ref(false)
const emit = defineEmits(["getimg"]);

const jmxdf = ref()
const fileList = ref([])
const mxzcxzfds = ref()
const url = ref()
const beforeUploadHandle = (file: IObject) => {
  zxczxtrtr.value = true
}

url.value = `${apiurl}/sys/oss/upload?token=${getToken()}`;
const successHandle = (data) => {
  props.dximg = data.data.src
  zxczxtrtr.value = false
  emit("getimg", data.data.src);
}

</script>
<style scoped></style>